package com.pan.driver;

import com.pan.action.MyAction;
import com.pan.anchor.MyAnchor;
import com.pan.listener.MyListener;
import com.pan.show.record.Record;
import com.pan.utils.ApplicationConfig;

import java.util.List;

public class MeasureDriver implements Driver{


    @Override
    public void run(){
        Record record = ApplicationConfig.INSTANCE.getRecordFactory().getRecord();
        record.setContent("my-measuring start\n");
        record.display();
        List<MyAction> actionList = ApplicationConfig.INSTANCE.getActionList();
        MyAnchor anchor = ApplicationConfig.INSTANCE.getAnchor();
        actionList.stream().map(action -> {
            MyListener listener = ApplicationConfig.INSTANCE.getListener();
            listener.setAction(action);
            return listener;
        }).forEach(anchor::addListener);


    }

}
